
angular.module("httpService",[]).
service('staffService',function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    getDepartment:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/getAll'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getAll'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByKeywords:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getByKeywords',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByDepartmentId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getByDepartmentId',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    updatePassword:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/updatePassword',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getStaffInfoByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getStaffInfoByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getStaffInfoByDepartment:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getStaffInfoByDepartment',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getStaffInfoByStaffId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/getStaffInfoByStaffId',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    validate:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/validate',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    heartAuthority:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/staff/heartAuthority',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
}).
service("relativeService",function ($http,$q) {
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/getByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
}).
service("noticeService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/notice/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/notice/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/notice/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/notice/getByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/notice/getAll',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
}).
service("busesService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        }
        else{
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        }
        else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getAll',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByBusOrderId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getByBusOrderId',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInfo:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getInfo'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInfoByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getInfoByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByBusOrderId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getByBusOrderId',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInfoByBusOrderId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getInfoByBusOrderId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getNearestBuses1:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getNearestBuses1',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getNearestBuses0:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/buses/getNearestBuses0',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
}).
service("busOrderService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/getAll',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/getByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getNearestBusorder0:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/getNearestBusorder0'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getNearestBusorder1:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/busOrder/getNearestBusorder1'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  };
}).
service("newsBlackBoardService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidateNews:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/newsBlackBoard/getValidateNews',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },

  };
}).
service("departmentService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/getAll',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByCount:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/department/getByCount',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
  };
}).
service("routesService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    update:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/routes/update',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/routes/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/routes/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAll:function(){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/routes/getAll',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }

  };
}).
service("ticketOrderService",function ($http,$q) {
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    insert:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/delete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    changeTicketInfo:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/changeTicketInfo',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getSeatsNumberLeft:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/getSeatsNumberLeft',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInfoByBusId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/getInfoByBusId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidateTicketsInfoByStaffId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/getValidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInvalidateTicketsInfoByStaffId:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/ticketOrder/getInvalidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
  }
}).
service("settingService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    about:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/about',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    help:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/help',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    busRule:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/busRule',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    softRule:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/softRule',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    version:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/version',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    versionUrl:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/versionUrl',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    feedback:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/feedback',
        method:"post",
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }

}).
service("carPoolingService",function ($http,$q) {
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    getValidateCarPooling:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/getValidateCarPooling'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/delete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getCategory:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/getCategory',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
}).
service("workBusesService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return{
    getValidate0:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workBuses/getValidate0',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidate1:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workBuses/getValidate1',
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
}).
service("workTicketOrderService",function($http,$q){
  var baseUrl="http://www.npic.site:8888/mobile";
  return {
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/delete',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInfoByBusId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getInfoByBusId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getWorkSeatReason:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getWorkSeatReason',

      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getValidateTicketsInfoByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getValidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getInvalidateTicketsInfoByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getInvalidateTicketsInfoByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAuditingTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getAuditingTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getAuditedTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/getAuditedTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    auditTicketInfoByAuditor:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/workTicketOrder/auditTicketInfoByAuditor',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
});
